/**
 * Created by yuzhou on 16/9/23.
 */

define([
    'vue','debug', 'text!tpl/userMenu.html',
    'vuex/actions/user'
], function(Vue, Debug, userMenuHtml, userAction) {

    var debug = Debug('App:Main:Header:UserMenu')

    return Vue.extend({
        template: userMenuHtml,
        components: {
        },
        vuex: {
            getters: {
                me: function(store){
                    return store.user.me
                }
            },
            actions: {
                setLoginUser: userAction.setLoginUser
            }
        },
        ready: function(){
            if(this.me == null) {
                this.setLoginUser()
            }
        }
    })
})